/*  1:   */ package org.jetbrains.java.debugger.breakpoints;
/*  2:   */ 
/*  3:   */

import com.intellij.debugger.ui.breakpoints.LineBreakpoint;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */ 
/* 16:   */ public abstract class JavaBreakpointAdapterBase
/* 17:   */   extends XBreakpointAdapter<XLineBreakpoint<XBreakpointProperties>>
/* 18:   */ {
/* 19:   */   protected final Project myProject;
/* 20:   */   
/* 21:   */   public JavaBreakpointAdapterBase(Project paramProject)
/* 22:   */   {
/* 23:20 */     this.myProject = paramProject;
/* 24:   */   }
/* 25:   */   
/* 26:   */   @Nullable
/* 27:   */   public LineBreakpoint createBreakpoint(XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint)
/* 28:   */   {
/* 29:25 */     String str = paramXLineBreakpoint.getFileUrl();
/* 30:26 */     VirtualFile localVirtualFile = VirtualFileManager.getInstance().findFileByUrl(str);
/* 31:27 */     Document localDocument = localVirtualFile != null ? FileDocumentManager.getInstance().getDocument(localVirtualFile) : null;
/* 32:28 */     if (localDocument == null) {
/* 33:29 */       return null;
/* 34:   */     }
/* 35:31 */     LineBreakpoint localLineBreakpoint = createInvisibleBreakpoint(this.myProject, localDocument, paramXLineBreakpoint);
/* 36:32 */     configureCreatedBreakpoint(localLineBreakpoint, paramXLineBreakpoint);
/* 37:33 */     return localLineBreakpoint;
/* 38:   */   }
/* 39:   */   
/* 40:   */   protected void configureCreatedBreakpoint(LineBreakpoint paramLineBreakpoint, XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint)
/* 41:   */   {
/* 42:37 */     RangeHighlighter localRangeHighlighter = paramLineBreakpoint.getHighlighter();
/* 43:38 */     if (localRangeHighlighter != null) {
/* 44:39 */       localRangeHighlighter.dispose();
/* 45:   */     }
/* 46:   */   }
/* 47:   */   
/* 48:   */   public final void breakpointChanged(@NotNull XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint)
/* 49:   */   {
/* 50:45 */     if (paramXLineBreakpoint == null) {
/* 51:45 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/java/debugger/breakpoints/JavaBreakpointAdapterBase", "breakpointChanged" }));
/* 52:   */     }
/* 53:45 */     LineBreakpoint localLineBreakpoint = findBreakpoint(paramXLineBreakpoint);
/* 54:46 */     if (localLineBreakpoint != null) {
/* 55:47 */       updateBreakpoint(localLineBreakpoint, paramXLineBreakpoint);
/* 56:   */     }
/* 57:   */   }
/* 58:   */   
/* 59:   */   protected abstract void updateBreakpoint(LineBreakpoint paramLineBreakpoint, XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint);
/* 60:   */   
/* 61:   */   protected abstract LineBreakpoint findBreakpoint(XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint);
/* 62:   */   
/* 63:   */   protected LineBreakpoint createInvisibleBreakpoint(Project paramProject, Document paramDocument, XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint)
/* 64:   */   {
/* 65:56 */     LineBreakpoint localLineBreakpoint = doCreateInstance(paramProject, paramDocument, paramXLineBreakpoint);
/* 66:57 */     localLineBreakpoint.setVisible(false);
/* 67:58 */     localLineBreakpoint.updateUI();
/* 68:59 */     localLineBreakpoint.setEnabled(paramXLineBreakpoint.isEnabled());
/* 69:60 */     return localLineBreakpoint;
/* 70:   */   }
/* 71:   */   
/* 72:   */   protected LineBreakpoint doCreateInstance(Project paramProject, Document paramDocument, XLineBreakpoint<XBreakpointProperties> paramXLineBreakpoint)
/* 73:   */   {
/* 74:64 */     return LineBreakpoint.create(paramProject, paramXLineBreakpoint);
/* 75:   */   }
/* 76:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.java.debugger.breakpoints.JavaBreakpointAdapterBase

 * JD-Core Version:    0.7.0.1

 */